<template>
	<div>
		<el-table :data="pageInfo.list" style="100%">
			<el-table-column label="库存ID" prop="id" width="80"></el-table-column>
			<el-table-column label="商品名称" prop="goods.goodsname" width="80"></el-table-column>
			<el-table-column label="当前数量" prop="currentsum" width="150"></el-table-column>
			<el-table-column label="安全存量" prop="safesum" width="150"></el-table-column>
			<el-table-column label="最后进货日期" prop="lastbuydate" width="160"></el-table-column>
			<el-table-column label="最后送货日期" prop="lastsaledate" width="160"></el-table-column>
			<el-table-column label="建议购买价" prop="buyprice" width="150"></el-table-column>
			<el-table-column label="建议销售价" prop="saleprice" width="150"></el-table-column>
		</el-table>
		
		<el-pagination
			layout="prev,pager,next,total,jumper"			
			:total="pageInfo.total"
			:page-size="pageInfo.pageSize"
			:page-count="pageInfo.navigatePages"
			:current-page="pageInfo.pageNum"
			background
			@current-change="handleCurrentChange"
		></el-pagination>
	</div>
</template>

<script>
	export default{
		data(){
			return{
				keyword:"",
				pageInfo:{
					pageNum:1,
					pageSize:5
				},
			}
		},
		created() {
			this.showData(1,this.pageInfo.pageSize,this.keyword);
		},
		methods:{
			showData(pageNum,pageSize,keyword){
				let url = "inventory/getPaged";
				let params = `pageNum=${pageNum}&pageSize=${pageSize}&keyword=${keyword}`;
				axios.post(url,params).then(resp=>{
					this.pageInfo = resp.data.data;
					// console.log(this.pageInfo.list);
				});
			},
			handleCurrentChange(pageNum){
				this.showData(pageNum,this.pageInfo.pageSize,this.keyword);
			}
				
		},
		
	}
</script>

<style>
</style>
